import { Vec3, easing, tween, Node } from "cc";

export class EffectHelper {

    //漂浮
    public static piaofu(node: Node) {
        let embedTween = tween(node)
            .by(1, { position: new Vec3(0, 10, 0) }, { progress: null, easing: easing.fade })
            .by(1, { position: new Vec3(0, -10, 0) }, { progress: null, easing: easing.fade })

        tween(node).repeatForever(embedTween).start()
    }

    //呼吸 s
    public static breath(node: Node) {
        tween(node)
            .repeatForever(
                tween()
                    .to(2, { opacity: 120 }, { progress: null, easing: easing.backInOut })
                    .to(2, { opacity: 255 }, { progress: null, easing: easing.backInOut })
            ).start();
    }

    //旋转 s
    public static rotationMv(node: Node) {
        tween(node)
            .repeatForever(
                tween()
                    .to(360, { angle: -3600 })
                    .start()
            ).start();
    }

}